#include <iostream>
#include <cmath>
using namespace std;
int unsed_val;
int main()
{
	int cnt,a[10002],ans;
	cin >> cnt;
	ans = 0;
	int i = 0;
	for (i = 0; i < cnt; i++)
	{
		cin >> a[i];
	}
    //boble sort a
	for (i = 0; i < cnt; i++)
	{
		for (int j = i + 1; j < cnt; j++)
		{
			if (a[i] > a[j])
			{
				int temp = a[i];
				a[i] = a[j];
				a[j] = temp;
				ans++;
			}
		}
	}
	cout << ans;
	return 0;
}